#include<stdio.h>
int main()
{
	FILE *fp1;
	FILE *fp2;
	fp1=fopen("file1.dat","w");//以写的方式打开
	fp2=fopen("file2.dat","wb+");
	char c;
	while(c!='#'){
		c=getchar();
		fputc(c,fp1);
	}
	fclose(fp1);
	fp1=fopen("file1.dat","r");//以读的方式打开
	while(1){
		c=fgetc(fp1);//从fp1中读取字符
		if(c!=EOF)
		{
			printf("%c",c);
			fputc(c,fp2);//将读取到的字符写入fp2
		}
		else break;
	}
	fclose(fp1);
	fclose(fp2);
	return 0;
}	
